<!DOCTYPE html>
<html lang="zh">
  <head>
    <script>
      /**
       * 加载 Loading
       * 请求失败，默认使用 htmlConfig 数据
       **/
      let htmlConfig = {
        bg: '#2B2C30',
        opacity: 100,
        src: './img/loading.gif'
      }
      let request = new XMLHttpRequest();
      try{
        request.open("GET", "./config.json", false);
        request.send(null);/*不发送数据到服务器*/
        if (request.status == 200) {
          const appLodingConfig = JSON.parse(request.responseText).app_loading;
          htmlConfig.bg = appLodingConfig.bg
          htmlConfig.opacity = appLodingConfig.opacity
          htmlConfig.src = appLodingConfig.src
        }
      } catch(error){ console.warn("loading 配置请求失败", error)}
      document.write('<div id="loadingApp" style="position:absolute;left:0;width:100%;height:100%;top:0;background:'+ htmlConfig.bg +';opacity:'+ htmlConfig.opacity / 100 +';z-index:10000;">'+
      '<div style="height: 100%;display: flex;align-items: center;justify-content: center;">'+
        '<img src="'+ htmlConfig.src +'"/>'+
      '</div></div>');
      document.onreadystatechange = function () {
        if (document.readyState == "complete") {
          let loadingMask = document.getElementById("loadingApp");
          loadingMask.parentNode.removeChild(loadingMask);
        }
      }
    </script>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
    <title><%= htmlWebpackPlugin.options.title %></title>
    <link rel="stylesheet" href="./static/materialdesignicons.min.css"/>
    <style>
      html,body,#app { height: 100%; margin: 0px; padding: 0px; }
      * ::-webkit-scrollbar { width: 0px; } /* 滚动条 */
    </style>
  </head>
  <body>
    <div id="app"></div>
  </body>
</html>
